﻿using System.Collections.Generic;
using System.Threading.Tasks;
using BCEntity.TMS.Driver.DriverExamine;

namespace BCData.TMS.Driver.DriverExamine
{
    public interface IDriverExamineMarkData
    {
        /// <summary>
        /// 新增司机考试成绩
        /// </summary>
        /// <param name="entity">司机考试成绩</param>
        /// <returns></returns>
        Task<long> InsertAsync(DriverExamineMarkEntity entity);
        /// <summary>
        /// 更新司机考试成绩
        /// </summary>
        /// <param name="entity">司机考试成绩</param>
        /// <returns></returns>
        Task<DriverExamineMarkEntity> UpdateAsync(DriverExamineMarkEntity entity);
        /// <summary>
        /// 删除司机考试成绩
        /// </summary>
        /// <param name="examineMarkId">考试成绩Id</param>
        /// <returns></returns>
        Task<bool> DeleteAsync(long examineMarkId);
        /// <summary>
        /// 获取考试成绩
        /// </summary>
        /// <param name="examineMarkId">考试成绩Id</param>
        /// <returns></returns>
        Task<DriverExamineMarkEntity> GetDriverExamineMarkByIdAsync(long examineMarkId);
        /// <summary>
        /// 分页查询考试成绩列表
        /// </summary>
        /// <param name="pageIndex">分页页码</param>
        /// <param name="pageSize">分页页数</param>
        /// <returns></returns>
        Task<(IEnumerable<DriverExamineMarkEntity>,int)> GetDriverExamineMarksAsync(int pageIndex, int pageSize);
        /// <summary>
        /// 检查考试成绩是否存在
        /// </summary>
        /// <param name="examineMarkId">考试成绩Id</param>
        /// <returns></returns>
        Task<bool> CheckExistsByIdAsync(long examineMarkId);
        /// <summary>
        /// 检查司机Id是否在使用
        /// </summary>
        /// <param name="examineMarkId">考试成绩Id</param>
        /// <returns></returns>
        Task<bool> CheckDriverIdInUsedAsync(long examineMarkId);
        /// <summary>
        /// 检查考试试卷是否被使用
        /// </summary>
        /// <param name="examineMarkId">考试成绩Id</param>
        /// <returns></returns>
        Task<bool> CheckPaperIdInUsedAsync(long examineMarkId);
        /// <summary>
        /// 获取考试成绩
        /// </summary>
        /// <param name="driverId">司机Id</param>
        /// <returns></returns>
        Task<DriverExamineMarkEntity> GetExamineMarkByDriverIdAsync(long driverId);

        /// <summary>
        /// 司机端如果司机考试失败，重新考试后更新成绩
        /// </summary>
        /// <returns></returns>
        Task<DriverExamineMarkEntity> UpdateMarkAsync(DriverExamineMarkEntity entity);
    }
}
